<template>
<div class="tab-bar-item" @click="itemclick">
  <div v-if="!activecolor"><slot name="icon-image">></slot></div>
  <div v-else><slot name="icon-active"></slot></div>
  <div :style="textcolor"><slot name="icon-text"></slot></div>
</div>
</template>

<script>
import router from "@/router";

export default {
name: "TabBarItem",
  props:{
  path:String,
  activetextcolor:{
    type:String,
    default:'#13B194'
  }
  },
  data(){
  return {
    isactive:false
  }

  },
  computed:{
  activecolor(){
    return this.$route.path.indexOf(this.path) !== -1
  },
    textcolor(){
    return this.activecolor?{color:this.activetextcolor}:{}
    }
  },
  methods:{
  itemclick(){

    this.$router.push(this.path)
    // console.log(this.path)
    // console.log(this.isactive)
  }
  }
}
</script>

<style scoped>
  .tab-bar-item {
    flex: 1;
    text-align: center;
    height: 49px;
    font-size: 14px;
  }

  .tab-bar-item img {
    width: 24px;
    height: 24px;
    margin-top: 3px;
    vertical-align: middle;
    margin-bottom: 2px;
  }
  .deeppink{
    color: #13B194;
  }
</style>